import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';


const Index = () => {
  const { t } = useTranslation('global');
  const { i18n } = useTranslation();
  const changeLanguage = (lng: string) => {
    i18n.changeLanguage(lng); // 更新应用语言
  };
  return (
      <div>
        <h2>{t('home.title')}</h2>
        <p>{t('home.body')}</p>
        <button onClick={() => changeLanguage('en')}>English</button>
        <button onClick={() => changeLanguage('es')}>Español</button>
        <button onClick={() => changeLanguage('zh')}>中文</button>
      </div>
  )
}

export default Index
